﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using Lapkin.Attributes;

namespace Lapkin.Models.DataModels
{
    public class Product
    {
        [Key]
        public Guid Id { get; set; }
        [Required]
        public String Name { get; set; }
        public String Description { get; set; }
        [Required]
        public Decimal Price { get; set; }
        [Required]
        [Unique(typeof(MainContext), "Alias", ErrorMessage = "Продукт с таким псевдонимом уже существует.")]
        public String Alias { get; set; }
        [Required]
        public Boolean IsActive { get; set; }

        public Guid? MainCategory { get; set; }

        public virtual ICollection<Category> Category { get; set; }
        public virtual ICollection<Image> Images { get; set; }

        public virtual ICollection<ProductPropertyProduct> Properties { get; set; }
        public virtual ICollection<ProductVariantProduct> Variants { get; set; }
    }
}